name: Generate rulex db and upload as artifact

on:
  push:
    branches:
      - 'master'
    paths:
      - 'data/**'

jobs:
  generate_db:
    name: generate_db
    runs-on: ubuntu-latest

    steps:
      - name: Clone.
        uses: actions/checkout@v3

      - name: Install dependencies.
        run: |
          sudo apt -q -y update
          sudo apt -q -y install libdb-dev libtool-bin

      - name: Generate_lexicon_db.
        run: |
          sudo locale-gen ru_RU.KOI8-R
          make
          mv data/lexicon data/rulex.db

      - name: Upload rulex.db
        uses: actions/upload-artifact@v3
        with:
          name: rulex-db
          path: data/rulex.db
